﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="index.aspx.cs" Inherits="AnyOffice.general.calendar.info.index" %>

<%@ Reference Page="~/general/index.aspx" %>
<%@ Register TagPrefix="cc1" Namespace="DataControls" Assembly="DataCalendar" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
<HTML>
	<HEAD>
		<title>日程安排查询</title>
		
		<meta content="Microsoft Visual Studio .NET 7.1" name="GENERATOR">
		<meta content="C#" name="CODE_LANGUAGE">
		<meta content="JavaScript" name="vs_defaultClientScript">
		<meta content="http://schemas.microsoft.com/intellisense/ie5" name="vs_targetSchema">
		<script>
my_top=50;
my_left=50;

function my_note(CAL_ID)
{
  my_top+=25;
  my_left+=15;

  window.open("note.aspx?cal_id="+CAL_ID,"note_win"+CAL_ID,"height=170,width=180,status=0,toolbar=no,menubar=no,location=no,scrollbars=auto,top="+ my_top +",left="+ my_left +",resizable=no");
}

function My_Submit()
{
  document.Form1.submit();
}

function set_year(op)
{
  if(op==-1 && document.Form1.selectYear.selectedIndex==0)
     return;
  if(op==1 && document.Form1.selectYear.selectedIndex==(document.Form1.selectYear.options.length-1))
     return;
  document.Form1.selectYear.selectedIndex=document.Form1.selectYear.selectedIndex+op;

  My_Submit();
}

function set_mon(op)
{
  if(op==-1 && document.Form1.selectMonth.selectedIndex==0)
     return;
  if(op==1 && document.Form1.selectMonth.selectedIndex==(document.Form1.selectMonth.options.length-1))
     return;
  document.Form1.selectMonth.selectedIndex=document.Form1.selectMonth.selectedIndex+op;

  My_Submit();
}

function now_mon()
{
	var date = new Date();
    document.Form1.selectYear.value = date.getFullYear();
	document.Form1.selectMonth.value = date.getMonth() + 1;
	My_Submit();
}

function edit_work(calid,user_id)
{
	var url = "edit.aspx?calid=" + calid + "&user_id=" + user_id;
	window.open(url,'oa_sub_window','height=260,width=500,status=0,toolbar=no,menubar=no,location=no,left=300,top=200,scrollbars=yes,resizable=yes');
}

function set_work(user_id)
{
	var url = "new.aspx?date=<%=ViewState["NowDay"]%>&user_id=" + user_id;
	window.open(url,'oa_sub_window','height=260,width=500,status=0,toolbar=no,menubar=no,location=no,left=300,top=200,scrollbars=yes,resizable=yes');
}
function del_work(calid,user_id)
{
	var url = "delete.aspx?date=<%=ViewState["NowDay"]%>&calid=" + calid + "&user_id=" + user_id;
	window.open(url,'oa_sub_window','height=260,width=500,status=0,toolbar=no,menubar=no,location=no,left=300,top=200,scrollbars=yes,resizable=yes');
}

		</script>
	</HEAD>
	<body class="bodycolor" topMargin="5">
		<form id="Form1" method="post" runat="server">
			<table class="small" cellSpacing="0" cellPadding="3" width="100%" border="0">
				<tr>
					<td class="Big3"><IMG src="/images/menu/calendar.gif" align="absMiddle">
						日程安排查询
						<asp:dropdownlist id="ddlDeptId" runat="server" AutoPostBack="True" CssClass="BigSelect" onselectedindexchanged="ddlDeptId_SelectedIndexChanged"></asp:dropdownlist>&nbsp;
						<INPUT class="BigButton" title="上一年" onclick="set_year(-1);" type="button" value="〈"><SELECT class="BigSelect" id="selectYear" onchange="My_Submit();" name="YEAR" runat="server">
							<OPTION value="1999">1999</OPTION>
							<OPTION value="2000">2000</OPTION>
							<OPTION value="2001">2001</OPTION>
							<OPTION value="2002">2002</OPTION>
							<OPTION value="2003">2003</OPTION>
							<OPTION value="2004">2004</OPTION>
							<OPTION value="2005">2005</OPTION>
							<OPTION value="2006">2006</OPTION>
							<OPTION value="2007">2007</OPTION>
							<OPTION value="2008">2008</OPTION>
							<OPTION value="2009">2009</OPTION>
							<OPTION value="2010">2010</OPTION>
							<OPTION value="2011">2011</OPTION>
							<OPTION value="2012">2012</OPTION>
							<OPTION value="2013">2013</OPTION>
							<OPTION value="2014">2014</OPTION>
							<OPTION value="2015">2015</OPTION>
							<OPTION value="2016">2016</OPTION>
						</SELECT><INPUT class="BigButton" title="下一年" onclick="set_year(1);" type="button" value="〉">
						年 
						<!-------------- 月 ------------><INPUT class="BigButton" title="上一月" onclick="set_mon(-1);" type="button" value="〈"><SELECT class="BigSelect" id="selectMonth" onchange="My_Submit();" name="MONTH" runat="server">
							<OPTION value="1">01</OPTION>
							<OPTION value="2">02</OPTION>
							<OPTION value="3">03</OPTION>
							<OPTION value="4">04</OPTION>
							<OPTION value="5">05</OPTION>
							<OPTION value="6">06</OPTION>
							<OPTION value="7">07</OPTION>
							<OPTION value="8">08</OPTION>
							<OPTION value="9">09</OPTION>
							<OPTION value="10">10</OPTION>
							<OPTION value="11">11</OPTION>
							<OPTION value="12">12</OPTION>
						</SELECT><INPUT class="BigButton" title="下一月" onclick="set_mon(1);" type="button" value="〉">
						月&nbsp;&nbsp;<INPUT class="BigButton" title="本月" onclick="now_mon();" type="button" value="本月">
					</td>
				</tr>
			</table>
			<div class="Big1" align="center"><cc1:datacalendar id="DataCalendar1" runat="server" CssClass="TableData" SelectionMode="Day" ShowNextPrevMonth="False"
					DayNameFormat="Full" ShowTitle="False" DayField="StartTime" Width="300px" BorderWidth="1px" BorderColor="Black" BorderStyle="Solid"
					Height="104px" onprerender="DataCalendar1_PreRender" onselectionchanged="DataCalendar1_SelectionChanged">
					<TodayDayStyle ForeColor="Red" CssClass="TableContent"></TodayDayStyle>
					<OtherMonthDayStyle ForeColor="DarkGray" CssClass="TableData" BackColor="LightGray"></OtherMonthDayStyle>
					<TitleStyle Font-Bold="True" CssClass="TableHeader"></TitleStyle>
					<DayStyle Font-Size="12px" Font-Names="sans-serif" Font-Bold="True" HorizontalAlign="Center"
						ForeColor="Blue" CssClass="TableData" VerticalAlign="Top"></DayStyle>
					<DayHeaderStyle CssClass="TableHeader"></DayHeaderStyle>
				</cc1:datacalendar><br>
				<asp:panel id="pnlDept" Runat="server">
					<TABLE class="small" cellSpacing="1" cellPadding="3" align="center" bgColor="#000000" border="0">
						<TR class="TableHeader" align="center">
							<TD class="Small" width="80">姓名</TD>
							<TD class="Small"><%=ViewState["NowDay"]%>(<%=GetWeekDay(Convert.ToDateTime(ViewState["NowDay"]))%>)
							</TD>
							<TD width="80">操作</TD>
						</TR>
						<asp:Repeater id="rptDept" runat="server">
											<ItemTemplate>
					<tr class="TableData">
						<td align="center"><%#Eval("UserName")%></td>
						<td class="TableData" nowrap width="200">
							<asp:Repeater ID="rptCalendar" Runat="server">
								<ItemTemplate>
									<span style="font-size:12px">
									<%# Convert.ToDateTime(Eval("StartTime")).ToString("t") %>
									-<%# Convert.ToDateTime(Eval("EndTime")).ToString("t") %></span><br>
									<%# (Eval("ManagerId") != DBNull.Value) ? "<a style=\"CURSOR: hand;font-size:12px;color:#0000ff\" onclick=\"javascript:edit_work('" + Eval("CalId").ToString() + "','" + Eval("UserId").ToString() + "');\">" : "" %>
									<%# Eval("Content") %>
									<%# (Eval("ManagerId") != DBNull.Value) ? "</a>" : "" %>
									<span style="font-size:12px">									
									<%# (Eval("ManagerId") != DBNull.Value) ? "&nbsp;<a style=\"CURSOR: hand;font-size:12px;color:#0000ff\" onclick=\"javascript:del_work('" + Eval("CalId").ToString() + "','" + Eval("UserId").ToString() + "');\">删除</a>" : "" %>
									</span>
									<%# (Eval("ManagerUserName") != DBNull.Value) ? "<br>安排人: " + Eval("ManagerUserName").ToString() + "" : "" %>
									<br>
								</ItemTemplate>
							</asp:Repeater>
						</td>
						<td width="80" align="center">
							<a href="javascript:set_work('<%#Eval("UserId")%>');">
								安排工作</a>
						</td>
					</tr>
				</ItemTemplate>				
				</asp:Repeater>
					</TABLE>
				</asp:panel></div>
			<asp:Literal id="litMessage" runat="server"></asp:Literal>
			<br>
			</form>
	</body>
</HTML>
